#include <skyroad/protocol/protocol.hpp>

int32 make_checksum(const byte* pData, int32 dwLen)
{
    unsigned long cksum=0;
    while(dwLen >1) 
    {
        cksum+=*pData++;
        dwLen-=sizeof(unsigned short);
    }

    if(dwLen)
    {
        cksum+=*(unsigned short*)pData;
    }

    cksum=(cksum >> 16)+(cksum&0xffff);
    cksum+=(cksum >>16);

    return ((unsigned short)cksum == 0xFFFF);
}

